﻿using Microsoft.AspNetCore.Mvc;
using MVC_System.DTO.RawMaterial;
using MVC_System.DTO.Rawmaterialtesting;
using WMS_MAV;

namespace MVC_System.Controllers
{
	public class RawmaterialtestingController : Controller
	{
		private readonly IConfiguration _configuration;
		public RawmaterialtestingController(IConfiguration configuration)
		{
			_configuration = configuration;
		}
		public IActionResult RawmaterialtestingAddView()
		{
			return View();
		}
		public async Task<ActionResult> SupplierxialaShow(RawMaterialDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "mhb/api/Supplier/Supplierxiala";
			var respomse = await client.GetAsync(url);
			return Json(respomse);
		}
		public async Task<ActionResult> RawmaterialtestingAdd(RawmaterialtestingAddDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "HysSwagger/api/Rawmaterialtesting/AddRawmaterialtesting";
			var respomse = await client.PostAsync(url, dto.Data);
			return Json(respomse);
		}
		public IActionResult RawmaterialtestingShowView()
		{
			return View();
		}
		public async Task<ActionResult> RawmaterialtestingShow(RawMaterialDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "HysSwagger/api/Rawmaterialtesting/GetRawmaterialtesting";
			var respomse = await client.GetAsync(url);
			return Json(respomse);
		}
		public async Task<ActionResult> RawmaterialtestingDelete(RawmaterialtestingDeleteDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "HysSwagger/api/Rawmaterialtesting/DeleteRawmaterialtesting";
			var respomse = await client.PostAsync(url, dto.Data);
			return Json(respomse);
		}
		public IActionResult RawmaterialtestingModelView()
		{
			return View();
		}

		public async Task<ActionResult> RawmaterialtestingModel(RawmaterialtestingModelDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "HysSwagger/api/Rawmaterialtesting/GetRawmaterialtestingModel?RawMaterialtestingId=" + dto.rawMaterialtestingId;
			var respomse = await client.GetAsync(url);
			return Json(respomse);
		}

		public IActionResult RawmaterialtestingUpdateView()
		{
			return View();
		}
		public async Task<ActionResult> RawmaterialtestingUpdate(RawmaterialtestingUpdateDTO dto)
		{
			HttpClientWrapper client = new HttpClientWrapper(dto.Token);
			string url = _configuration["Url"] + "HysSwagger/api/Rawmaterialtesting/UpdateRawmaterialtesting";
			var respomse = await client.PostAsync(url, dto.Data);
			return Json(respomse);
		}
	}
}
